package spindles.api.db;

import java.util.Set;

import spindles.api.domain.Person;

public class PersonDAO extends DAO<Person>{		
	
	public PersonDAO(){
		super(Person.class);
	}
	
	public boolean exists(Person p){		
		Set<Person> ps = findAll();		
		return ps.contains(p);
	}
	
	public Person find(String firstName, String lastName){
		Set<Person> ps = findAll();
		for(Person old : ps){
			if((old.getFirstName().equals(firstName)) && 
			(old.getLastName().equals(lastName))){
				return old;
			}
		}	
		
		return null;
	}

}
